<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>体育馆场地预约管理系统-登录</title>
    <%
        String basePath = request.getScheme()
                + "://" + request.getServerName()
                + ":" + request.getServerPort()
                + request.getContextPath()
                + "/";
    %>
    <base href="<%=basePath%>">


    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="font-awesome/css/font-awesome.css" rel="stylesheet">

    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <style>
        body {
            background-image: url("<%=request.getContextPath()%>/img/bg.png");
            background-attachment: fixed;
            background-size: 100%;
            no-repeat: center top;
            height: 100%;
            width: 100%;
        }
    </style>

    <script src="js/jquery-3.1.1.min.js"></script>
    <script>
        $(function () {
            let $username = $('#username');
            let $password = $('#password');
            let $msg = $('#msg');

            /*$username.blur(function () {
                let text = $username.val();
                if (text.trim() === "") {
                    $msg.text("用户名不能为空！");
                }
            })

            $password.blur(function () {
                let text = $password.val();
                if (text.trim() === "") {
                    $msg.text("密码不能为空！");
                }
            })*/

            $('#submit').click(function () {
                let text = $username.val();
                if (text.trim() === "") {
                    $msg.text("用户名不能为空！");
                    return false
                }

                let text2 = $password.val();
                if (text2.trim() === "") {
                    $msg.text("密码不能为空！");
                    return false
                }
            })
        })
    </script>

</head>

<body>

<div class="middle-box text-center loginscreen animated fadeInDown">
    <div>
        <div>

            <h2 style="color: #7e7676">体育馆场地预约管理系统</h2>

        </div>
        <h3>欢迎登录</h3>
        <div id="msg" style="color: red">${msg}</div>
        <form method="post" class="m-t" role="form" action="userController">
            <input type="hidden" name="action" value="login">
            <div class="form-group">
                <input type="text" id="username" class="form-control" name="username" placeholder="用户名">
            </div>
            <div class="form-group">
                <input type="password" id="password" class="form-control" name="password" placeholder="密码">
            </div>
            <div class="form-control">
                验证码：<input type="text" style="width: 80px;" name="code">
                <img id="codeimg" src="kaptcha.jpg" alt="" style="width: 100px; height: 28px;"> <br>
            </div>
            <button id="submit" type="submit" class="btn btn-primary block full-width m-b">登录</button>

            <a class="btn btn-sm btn-white btn-block" href="register.jsp">点击注册</a>
        </form>
        <p class="m-t"><small>体育馆场地预约管理系统&copy; 2022</small></p>
    </div>
</div>

<!-- Mainly scripts -->
<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>

<script>
    $(function () {
        $('#codeimg').click(function () {
            this.src = "kaptcha.jpg?d=" + new Date();
        })
    })
</script>

</body>

</html>
